
* data		
use "data/inputs/PrecinctData.dta", clear

* normalize
egen mesascount = count(chavista), by(year)
sort year nonmiss_twoprevyears
by year: gen n = _n 
gen pctile = n / mesascount

* graph for paper
#delimit;
twoway  (lpolyci chavista pctile if year == 1998, 
	     lcolor(blue%50) lwidth(vthin) ciplot(rline) degree(1))
		(lpoly chavista pctile if year == 1998, lcolor(blue) degree(1))
		(lpolyci chavista pctile if year == 2000, 
	     lcolor(blue%30) lwidth(vthin) ciplot(rline) degree(1))
		(lpoly chavista pctile if year == 2000, lcolor(blue%70) degree(1))
		(lpolyci chavista pctile if year == 2006, 
	     lcolor(black%30) lwidth(vthin) ciplot(rline) degree(1))
		(lpoly chavista pctile if year == 2006, lcolor(black%50) degree(1))
	    (lpolyci chavista pctile if year == 2012, 
	     lcolor(black%50) lwidth(vthin) ciplot(rline) degree(1))
		(lpoly chavista pctile if year == 2012, lcolor(black) degree(1)),
		legend(off)
		graphregion(fcolor(white) lcolor(white) margin(zero))
        plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
        xsize(11) ysize(7.75)
		title("", size(large))
		ytitle("Chávez Vote Share", color(black) size(large))
		xtitle("Percentile of Distribution of Formal Employment", size(large))
        yscale()
		ylabel(.3(.1).9, labsize(large) glcolor(white) angle(horizontal))
		xlabel(, labsize(large));
graph export "figures/Figure4.pdf", replace;

* End
